/****************************************************************************
 *
 * Copyright (C) 2003-2008 Los Alamos National Security, LLC
 *                         Packet Analytics Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2 as
 * published by the Free Software Foundation.  You may not use, modify or
 * distribute this program under any other version of the GNU General
 * Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 ****************************************************************************/
package nfse.query;

import java.util.Vector;

/**
 * This is a container class for storing and outputting XML for query results
 * that are to be joined by the SearchEngine.
 * 
 * @author bduphoff
 * 
 */
public class Join {
    private Vector<Query> queries = new Vector<Query>();

    public Join() {
    }

    public boolean validate() {
        // This should check to see that the query vector contains
        // valid, joinable subqueries (i.e. all of the same type)
        return true;
    }

    public void addQuery(Query query) {
        queries.addElement(query);
    }

    public String toXML() {
        String temp = "";
        temp += "<Join>";
        for (int i = 0; i < queries.size(); i++)
            temp += ((Query) queries.elementAt(i)).toXML();
        temp += "</Join>";
        return temp;
    }

    public String toString() {
        return this.toXML();
    }
}